package com.jt.www.hadoopcould.service.impl;


import com.jt.www.hadoopcould.dao.HadoopFileDao;
import com.jt.www.hadoopcould.model.HadoopFile;
import com.jt.www.hadoopcould.service.HadoopFileService;
import com.jt.www.hadoopcould.util.HadoopFileUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.InputStream;

@Service
public class HadoopFileServiceImpl implements HadoopFileService {

    @Autowired
    private HadoopFileDao hadoopFileDao;


    @Override
    public double addFile(HadoopFile hadoopFile, InputStream inputStream) {
        hadoopFileDao.save(hadoopFile);
        HadoopFileUtil hfu=new HadoopFileUtil();
        hfu.createFileByInputStream(inputStream,"/opt/"+hadoopFile.getFileName());

        return 0;
    }

    @Override
    public double updateFile(HadoopFile hadoopFile, InputStream inputStream) {
        return 0;
    }

    @Override
    public double deleteFile(HadoopFile hadoopFile) {
        return 0;
    }

    @Override
    public double findFile(String fileid) {
        return 0;
    }

    @Override
    public double findAllFile(String userid) {
        return 0;
    }
}
